package org.example.test.helloworld;

import io.grpc.stub.StreamObserver;
import net.devh.boot.grpc.server.service.GrpcService;

/**
 * @author liyishan
 * @date 2023/7/21 13:06
 * @apiNote
 */
@GrpcService
public class OperateImpl extends OperateGrpc.OperateImplBase{
    /**
     * @param request
     * @param responseObserver
     */
    @Override
    public void calculate(Request request, StreamObserver<Response> responseObserver) {
        Response response = Response.newBuilder().setResult(
                request.getNum1()+request.getNum2()
        ).build();
        System.out.println(response);
        responseObserver.onNext(response);
        responseObserver.onCompleted();
        //super.calculate(request, responseObserver);
    }
}
